package com.jiepu.daily.corejava.advanceed.part7network.day0812;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

/**
 * @Description:
 * @author: xinjie
 * @date: 2020/8/12  8:13
 */
public class ChatClient1 {
	public static void main(String[] args) {
		final String ip = "localhost";
		final int port = 8888;
		try {
			Socket socket = new Socket(ip, port);
			System.out.println("Client连接成功");

			System.out.println();
			System.out.println("输出流 ");
			OutputStream os = socket.getOutputStream();
			String msg = "Xinjie hmr jj";
			msg = msg.length()+"|"+msg;
			os.write(msg.getBytes());
			os.flush();
			// 接受 -1； shutdown 返回-1；
			//socket.shutdownOutput();

		} catch (IOException e) {
			e.printStackTrace();
		}


	}

}
